www.gusucode.com > XerCMS 携云PHP企业建站程序 v2015PHP源码程序 > XerCMS 携云PHP企业建站程序 v2015/XerCMS_v20150724/XerCMS_v20150724/XerCMS/Library/remote/XerCMS_ftp.php
<?php /** * @name XERCMS * @author Arno <XerCMS@163.com> [QQ:1328013] * @version 1.0.0 * @link http://www.XerCMS.com */ !defined('XERCMS') && exit('Access Denied'); class ftp { var $config = array(); var $conn = 1; function __construct() { } function Init($params) { $this->config = $params; } function connect() { $this->conn = ftp_connect($this->config['host'], (isset($this->config['post']) ? $this->config['post'] : 21), (isset($this->config['timeout']) ? $this->config['timeout'] : 10) ); if(!$this->conn) return false; return true; } function login() { return ftp_login($this->conn,$this->config['user'],$this->config['pass']); } function del() { } function mkdir($dir) { $curr = ftp_pwd($this->conn); if(ftp_chdir($this->conn,$dir)) { ftp_chdir($this->conn,$curr); return; } ftp_mkdir($this->conn,$dir); } function put($local,$remote) { $this->mkdir(dirname($remote)); if($this->config['pasv'] == 'yes') { if(!ftp_pasv($this->conn, true)) return false; } return ftp_put($this->conn,$remote,$local,FTP_BINARY); } function __destory() { if($this->conn != null) { ftp_close($this->conn); } } } ?>